﻿USE [NMA]
GO
/****** Object:  Table [dbo].[News]    Script Date: 04/13/2010 13:47:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[News](
	[ID] [uniqueidentifier] NOT NULL,
	[Title] [nvarchar](500) NOT NULL,
	[ShortDescription] [text] NOT NULL,
	[Content] [text] NOT NULL,
	[IsPublish] [bit] NOT NULL,
	[PublishedDate] [datetime] NULL CONSTRAINT [DF_News_PublishedDate]  DEFAULT (getdate()),
	[PublishedPerson] [nvarchar](30) NULL,
	[NumberOfView] [int] NULL,
	[Image] [varbinary](max) NULL,
	[Category_Id] [uniqueidentifier] NULL,
	[CreatedDate] [datetime] NOT NULL CONSTRAINT [DF_News_CreatedDate]  DEFAULT (getdate()),
	[UpdatedDate] [datetime] NULL CONSTRAINT [DF_News_UpdatedDate]  DEFAULT (getdate()),
	[CreatedUser] [nvarchar](30) NOT NULL,
	[UpdatedUser] [nvarchar](30) NULL,
	[Poll_Id] [uniqueidentifier] NULL,
 CONSTRAINT [PK_News] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
ALTER TABLE [dbo].[News]  WITH CHECK ADD  CONSTRAINT [FK_News_Category] FOREIGN KEY([Category_Id])
REFERENCES [dbo].[Category] ([ID])
GO
ALTER TABLE [dbo].[News] CHECK CONSTRAINT [FK_News_Category]
GO
ALTER TABLE [dbo].[News]  WITH CHECK ADD  CONSTRAINT [FK_News_Poll] FOREIGN KEY([Poll_Id])
REFERENCES [dbo].[Poll] ([ID])
GO
ALTER TABLE [dbo].[News] CHECK CONSTRAINT [FK_News_Poll]